import { createSSRApp } from "vue";
import { bootstrap } from "/@/cool/bootstrap";
import App from "./App.vue";
import "./router";
import { createI18n } from "vue-i18n";
import "animate.css";
import { storage } from "/@/cool/utils";
// 加载多语言资源
import en from "./language/en";
import zh from "./language/zh";

const i18n = createI18n({
	legacy: false, // Vue3模式下必须设置为false
	globalInjection: true, // 允许注入到全局 this 上
	locale: storage.get("lang") || "zh", // 默认语言
	messages: {
		en,
		zh,
	},
});

export function createApp() {
	const app = createSSRApp(App);
	app.use(i18n);
	// 启动
	bootstrap(app);

	return {
		app,
		i18n,
	};
}
